class MyClass:
    def __init__(self,name,age):
        self.name=name
        self.age=age

    def __setattr__(self, key, value):
        if key=="name":
            if isinstance(value,str):
                super().__setattr__(key,value)
            else:
                raise TypeError("name属性只能设置为字符串")
        elif key=="age":
            if isinstance(value,int):
                super().__setattr__(key,value)
            else:
                raise TypeError("age属性只能设置为int")
        else:
            super().__setattr__(key,value)

    def __delattr__(self, item):
        if item=="name":
            raise TypeError("name属性不能被删除")
        else:
            super().__delattr__(self,item)

    def __getattribute__(self, item):
        if item=="age":
            value=super().__getattribute__(item)
            if value<0:
                value=0
                return value
            else:
                return super().__getattribute__(item)

m=MyClass("musen",11)
print(m.name,m.age)


